package cn.kgc.shiro01;

import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/7/27
 * @Description: shiro 密码加密方式
 * 12345 = 827ccb0eea8a706c4c34a16891f84e7b
 * 12345+java2320 = 4726584c59d4f8e79bdf2715dd7c5026
 * 12345+java2320+1024hash = 2d8aa1bb8d0828a8414d61ab017d683e
 */
public class TestMD5 {

    public static void main(String[] args) {

        //  md5加密处理
        String password = "12345";
        String s = new Md5Hash(password).toHex();
        System.out.println("12345 = " + s);

        // MD5+salt
        String salt = "java2320";
        String s1 = new Md5Hash(password, salt).toHex();
        System.out.println("12345+java2320 = " + s1);

        // md5+salt+hash
        String s2 = new Md5Hash(password, salt, 1024).toHex();
        System.out.println("12345+java2320+1024hash = " + s2);


    }
}
